#e
#Title[ᐯuBX^[NX}X-Hard-v]
#Text[G@Lu`mv]
#ScriptVersion[2]
#PlayLevel[Hard]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "ᐯuBX^[NX}Xv";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(5000);
  SetScore(1000000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 24);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TStar;
  TMove;
  TSstar
 }

 task TStar {
  yield;

  loop {
   loop(8) { yield; }
   CreateShot01(rand(GetClipMinX, GetClipMaxX), GetClipMinY, 0.4, rand(45, 135), WHITE11, 0);
  }
 }

 task TMove {
  yield;

  loop {
   loop(10) { yield; }
   moveX(rand(-100, 100), 120);
   loop(120) { yield; }
  }
 }

 task TSstar {
  let angle = 45;
  let angle2 = 90;
  yield;

  loop {
   loop(150) { yield; }
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle - 1.5, BLUE03, 0);
   angle = rand(45, 85);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle2 + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2 - 1.5, BLUE03, 0);
   angle2 = rand(95, 135);
   loop(45) { yield; }
   CreateLaser01(GetClipMaxX, rand(GetClipMinY, GetCenterY), 3, rand(135, 160), 200, 10, WHITE11, 0);
  }
 }

 function moveX(xMove, frame) {
  let x;

  x = GetX + xMove;
  if(x < GetClipMinX + 20) {
   x = GetClipMinX + 40;
  }
  else if(x > GetClipMaxX - 20) {
   x = GetClipMaxX - 40;
  }

  SetMovePosition02(x, GetY, frame);
 }

}